<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0088)http://www.cnblogs.com/gaochundong/archive/2013/06/01/csharp_emit_generate_assembly.html -->
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-cn"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script async="" src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/analytics.js"></script>

<title>秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园</title>
<link type="text/css" rel="stylesheet" href="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/blog-common.css">
<link id="MainCss" type="text/css" rel="stylesheet" href="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/bundle-iMetro_HD.css">
<link type="text/css" rel="stylesheet" href="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/77744.css">
<link title="RSS" type="application/rss+xml" rel="alternate" href="http://www.cnblogs.com/gaochundong/rss">
<link title="RSD" type="application/rsd+xml" rel="EditURI" href="http://www.cnblogs.com/gaochundong/rsd.xml">
<link type="application/wlwmanifest+xml" rel="wlwmanifest" href="http://www.cnblogs.com/gaochundong/wlwmanifest.xml">
<script type="text/javascript" src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/encoder.js"></script><script async="" type="text/javascript" src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/gpt.js"></script><script src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/jquery.js" type="text/javascript"></script>  
<script type="text/javascript">var currentBlogApp = 'gaochundong', cb_enable_mathjax=true;</script>
<script src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/blog-common.js" type="text/javascript"></script>
<script async="" type="text/javascript" src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/pubads_impl_50.js"></script><style type="text/css">#yddContainer{display:block;font-family:Microsoft YaHei;position:relative;width:100%;height:100%;top:-4px;left:-4px;font-size:12px;border:1px solid}#yddTop{display:block;height:22px}#yddTopBorderlr{display:block;position:static;height:17px;padding:2px 28px;line-height:17px;font-size:12px;color:#5079bb;font-weight:bold;border-style:none solid;border-width:1px}#yddTopBorderlr .ydd-sp{position:absolute;top:2px;height:0;overflow:hidden}.ydd-icon{left:5px;width:17px;padding:0px 0px 0px 0px;padding-top:17px;background-position:-16px -44px}.ydd-close{right:5px;width:16px;padding-top:16px;background-position:left -44px}#yddKeyTitle{float:left;text-decoration:none}#yddMiddle{display:block;margin-bottom:10px}.ydd-tabs{display:block;margin:5px 0;padding:0 5px;height:18px;border-bottom:1px solid}.ydd-tab{display:block;float:left;height:18px;margin:0 5px -1px 0;padding:0 4px;line-height:18px;border:1px solid;border-bottom:none}.ydd-trans-container{display:block;line-height:160%}.ydd-trans-container a{text-decoration:none;}#yddBottom{position:absolute;bottom:0;left:0;width:100%;height:22px;line-height:22px;overflow:hidden;background-position:left -22px}.ydd-padding010{padding:0 10px}#yddWrapper{color:#252525;z-index:10001;background:url(chrome-extension://eopjamdnofihpioajgfdikhhbobonhbb/ab20.png);}#yddContainer{background:#fff;border-color:#4b7598}#yddTopBorderlr{border-color:#f0f8fc}#yddWrapper .ydd-sp{background-image:url(chrome-extension://eopjamdnofihpioajgfdikhhbobonhbb/ydd-sprite.png)}#yddWrapper a,#yddWrapper a:hover,#yddWrapper a:visited{color:#50799b}#yddWrapper .ydd-tabs{color:#959595}.ydd-tabs,.ydd-tab{background:#fff;border-color:#d5e7f3}#yddBottom{color:#363636}#yddWrapper{min-width:250px;max-width:400px;}</style><meta name="chromesniffer" id="chromesniffer_meta" content="{&quot;jQuery&quot;:&quot;1.7&quot;}"><script type="text/javascript" src="chrome-extension://homgcnaoacgigpkkljjjekpignblkeae/detector.js"></script><style type="text/css">.MathJax_Hover_Frame {border-radius: .25em; -webkit-border-radius: .25em; -moz-border-radius: .25em; -khtml-border-radius: .25em; box-shadow: 0px 0px 15px #83A; -webkit-box-shadow: 0px 0px 15px #83A; -moz-box-shadow: 0px 0px 15px #83A; -khtml-box-shadow: 0px 0px 15px #83A; border: 1px solid #A6D ! important; display: inline-block; position: absolute}
.MathJax_Hover_Arrow {position: absolute; width: 15px; height: 11px; cursor: pointer}
</style><style type="text/css">#MathJax_About {position: fixed; left: 50%; width: auto; text-align: center; border: 3px outset; padding: 1em 2em; background-color: #DDDDDD; color: black; cursor: default; font-family: message-box; font-size: 120%; font-style: normal; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; border-radius: 15px; -webkit-border-radius: 15px; -moz-border-radius: 15px; -khtml-border-radius: 15px; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
.MathJax_Menu {position: absolute; background-color: white; color: black; width: auto; padding: 2px; border: 1px solid #CCCCCC; margin: 0; cursor: default; font: menu; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
.MathJax_MenuItem {padding: 2px 2em; background: transparent}
.MathJax_MenuArrow {position: absolute; right: .5em; color: #666666}
.MathJax_MenuActive .MathJax_MenuArrow {color: white}
.MathJax_MenuArrow.RTL {left: .5em; right: auto}
.MathJax_MenuCheck {position: absolute; left: .7em}
.MathJax_MenuCheck.RTL {right: .7em; left: auto}
.MathJax_MenuRadioCheck {position: absolute; left: 1em}
.MathJax_MenuRadioCheck.RTL {right: 1em; left: auto}
.MathJax_MenuLabel {padding: 2px 2em 4px 1.33em; font-style: italic}
.MathJax_MenuRule {border-top: 1px solid #CCCCCC; margin: 4px 1px 0px}
.MathJax_MenuDisabled {color: GrayText}
.MathJax_MenuActive {background-color: Highlight; color: HighlightText}
.MathJax_Menu_Close {position: absolute; width: 31px; height: 31px; top: -15px; left: -15px}
</style><style type="text/css">#MathJax_Zoom {position: absolute; background-color: #F0F0F0; overflow: auto; display: block; z-index: 301; padding: .5em; border: 1px solid black; margin: 0; font-weight: normal; font-style: normal; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; box-shadow: 5px 5px 15px #AAAAAA; -webkit-box-shadow: 5px 5px 15px #AAAAAA; -moz-box-shadow: 5px 5px 15px #AAAAAA; -khtml-box-shadow: 5px 5px 15px #AAAAAA; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
#MathJax_ZoomOverlay {position: absolute; left: 0; top: 0; z-index: 300; display: inline-block; width: 100%; height: 100%; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
#MathJax_ZoomFrame {position: relative; display: inline-block; height: 0; width: 0}
#MathJax_ZoomEventTrap {position: absolute; left: 0; top: 0; z-index: 302; display: inline-block; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
</style><style type="text/css">.MathJax_Preview {color: #888}
#MathJax_Message {position: fixed; left: 1em; bottom: 1.5em; background-color: #E6E6E6; border: 1px solid #959595; margin: 0px; padding: 2px 8px; z-index: 102; color: black; font-size: 80%; width: auto; white-space: nowrap}
#MathJax_MSIE_Frame {position: absolute; top: 0; left: 0; width: 0px; z-index: 101; border: 0px; margin: 0px; padding: 0px}
.MathJax_Error {color: #CC0000; font-style: italic}
</style><script type="text/javascript" src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/osd.js"></script></head>
<body><div id="MathJax_Message" style="display: none;"></div>
<a name="top"></a>
<!--PageBeginHtml Block Begin-->
<a href="https://github.com/gaochundong"><img style="position: absolute; top: 0; right: 0; border: 0; z-index:999999" src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png"></a>
<!--PageBeginHtml Block End-->

<!--done-->
<div id="home">
<div id="header">
	<div id="blogTitle">
	<a id="lnkBlogLogo" href="http://www.cnblogs.com/gaochundong/"><img id="blogLogo" src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/logo.gif" alt="返回主页"></a>			
		
<!--done-->
<h1><a id="Header1_HeaderTitle" class="headermaintitle" href="http://www.cnblogs.com/gaochundong/">Scale-out Thinking</a></h1>
<h2></h2>



		
	</div><!--end: blogTitle 博客的标题和副标题 -->
	<div id="navigator">
		
<ul id="navList">
<li><a id="MyLinks1_HomeLink" class="menu" href="http://www.cnblogs.com/">博客园</a></li>
<li><a id="MyLinks1_MyHomeLink" class="menu" href="http://www.cnblogs.com/gaochundong/">首页</a></li>
<li><a class="menu" href="http://q.cnblogs.com/">博问</a></li>
<li><a class="menu" href="http://home.cnblogs.com/ing/">闪存</a></li>
<li></li>
<li></li>
<li><a id="MyLinks1_Syndication" class="menu" href="http://www.cnblogs.com/gaochundong/rss">订阅</a>
<!--<a id="MyLinks1_XMLLink" class="aHeaderXML" href="http://www.cnblogs.com/gaochundong/rss"><img src="http://www.cnblogs.com/images/xml.gif" alt="订阅" /></a>--></li>
<li><a id="MyLinks1_Admin" class="menu" rel="nofollow" href="http://i.cnblogs.com/">管理</a></li>
</ul>
		<div class="blogStats">
			
			
<!--done-->
随笔- 153&nbsp;
文章- 0&nbsp;
评论- 1205&nbsp;

			
		</div><!--end: blogStats -->
	</div><!--end: navigator 博客导航栏 -->
</div><!--end: header 头部 -->

<div id="main">
	<div id="mainContent">
	<div class="forFlow">
		

<!--done-->
<div id="topics">
	<div class="post">
		<h1 class="postTitle">
			<a id="cb_post_title_url" class="postTitle2" href="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园.htm">秒懂C#通过Emit动态生成代码</a>
		</h1>
		<div class="clear"></div>
		<div class="postBody">
			<div id="cnblogs_post_body"><p>首先需要声明一个程序集名称，</p>
<div class="cnblogs_code">
<pre><span style="color: #008080;">1</span> <span style="color: #008000;">//</span><span style="color: #008000;"> specify a new assembly name</span>
<span style="color: #008080;">2</span> <span style="color: #0000ff;">var</span> assemblyName = <span style="color: #0000ff;">new</span> AssemblyName(<span style="color: #800000;">"</span><span style="color: #800000;">Kitty</span><span style="color: #800000;">"</span>);</pre>
</div>
<p>从当前应用程序域获取程序集构造器，</p>
<div class="cnblogs_code">
<pre><span style="color: #008080;">1</span> <span style="color: #008000;">//</span><span style="color: #008000;"> create assembly builder</span>
<span style="color: #008080;">2</span> <span style="color: #0000ff;">var</span> assemblyBuilder =<span style="color: #000000;"> AppDomain.CurrentDomain
</span><span style="color: #008080;">3</span>   .DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave);</pre>
</div>
<p>有几种动态程序集构造访问限制：</p>
<ul>
<li>AssemblyBuilderAccess.Run; 表示程序集可被执行，但不能被保存。　　</li>
<li>AssemblyBuilderAccess.Save; 表示程序集可被保存，但不能被执行。　　</li>
<li>AssemblyBuilderAccess.RunAndSave; 表示程序集可被保存并能被执行。</li>
<li>AssemblyBuilderAccess.ReflectionOnly; 表示程序集只能用于反射上下文环境中，不能被执行。　</li>
<li>AssemblyBuilderAccess.RunAndCollect; 表示程序集可以被卸载并且内存会被回收。</li>
</ul>
<p>在程序集中构造动态模块，</p>
<div class="cnblogs_code">
<pre><span style="color: #008080;">1</span> <span style="color: #008000;">//</span><span style="color: #008000;"> create module builder</span>
<span style="color: #008080;">2</span> <span style="color: #0000ff;">var</span> moduleBuilder = assemblyBuilder.DefineDynamicModule(<span style="color: #800000;">"</span><span style="color: #800000;">KittyModule</span><span style="color: #800000;">"</span>, <span style="color: #800000;">"</span><span style="color: #800000;">Kitty.exe</span><span style="color: #800000;">"</span>);</pre>
</div>
<p>模块即是代码的集合，一个程序集中可以有多个模块。并且理论上讲，每个模块可以使用不同的编程语言实现，例如C#/VB。<br>构造一个类型构造器，</p>
<div class="cnblogs_code">
<pre><span style="color: #008080;">1</span> <span style="color: #008000;">//</span><span style="color: #008000;"> create type builder for a class</span>
<span style="color: #008080;">2</span> <span style="color: #0000ff;">var</span> typeBuilder = moduleBuilder.DefineType(<span style="color: #800000;">"</span><span style="color: #800000;">HelloKittyClass</span><span style="color: #800000;">"</span>, TypeAttributes.Public);</pre>
</div>
<p>通过类型构造器定义一个方法，获取方法构造器，获得方法构造器的IL生成器，通过编写IL代码来定义方法功能。</p>
<div class="cnblogs_code"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/copycode.gif" alt="复制代码"></a></span></div>
<pre><span style="color: #008080;"> 1</span> <span style="color: #008000;">//</span><span style="color: #008000;"> create method builder</span>
<span style="color: #008080;"> 2</span> <span style="color: #0000ff;">var</span> methodBuilder =<span style="color: #000000;"> typeBuilder.DefineMethod(
</span><span style="color: #008080;"> 3</span>   <span style="color: #800000;">"</span><span style="color: #800000;">SayHelloMethod</span><span style="color: #800000;">"</span><span style="color: #000000;">,
</span><span style="color: #008080;"> 4</span>   MethodAttributes.Public |<span style="color: #000000;"> MethodAttributes.Static,
</span><span style="color: #008080;"> 5</span>   <span style="color: #0000ff;">null</span><span style="color: #000000;">,
</span><span style="color: #008080;"> 6</span>   <span style="color: #0000ff;">null</span><span style="color: #000000;">);
</span><span style="color: #008080;"> 7</span>  
<span style="color: #008080;"> 8</span> <span style="color: #008000;">//</span><span style="color: #008000;"> then get the method il generator</span>
<span style="color: #008080;"> 9</span> <span style="color: #0000ff;">var</span> il =<span style="color: #000000;"> methodBuilder.GetILGenerator();
</span><span style="color: #008080;">10</span>  
<span style="color: #008080;">11</span> <span style="color: #008000;">//</span><span style="color: #008000;"> then create the method function</span>
<span style="color: #008080;">12</span> il.Emit(OpCodes.Ldstr, <span style="color: #800000;">"</span><span style="color: #800000;">Hello, Kitty!</span><span style="color: #800000;">"</span><span style="color: #000000;">);
</span><span style="color: #008080;">13</span> <span style="color: #000000;">il.Emit(OpCodes.Call, 
</span><span style="color: #008080;">14</span>   <span style="color: #0000ff;">typeof</span>(Console).GetMethod(<span style="color: #800000;">"</span><span style="color: #800000;">WriteLine</span><span style="color: #800000;">"</span>, <span style="color: #0000ff;">new</span> Type[] { <span style="color: #0000ff;">typeof</span>(<span style="color: #0000ff;">string</span><span style="color: #000000;">) }));
</span><span style="color: #008080;">15</span> il.Emit(OpCodes.Call, <span style="color: #0000ff;">typeof</span>(Console).GetMethod(<span style="color: #800000;">"</span><span style="color: #800000;">ReadLine</span><span style="color: #800000;">"</span><span style="color: #000000;">));
</span><span style="color: #008080;">16</span> il.Emit(OpCodes.Pop); <span style="color: #008000;">//</span><span style="color: #008000;"> we just read something here, throw it.</span>
<span style="color: #008080;">17</span> il.Emit(OpCodes.Ret);</pre>
<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/copycode.gif" alt="复制代码"></a></span></div></div>
<p>创建类型，</p>
<div class="cnblogs_code">
<pre><span style="color: #008080;">1</span> <span style="color: #008000;">//</span><span style="color: #008000;"> then create the whole class type</span>
<span style="color: #008080;">2</span> <span style="color: #0000ff;">var</span> helloKittyClassType = typeBuilder.CreateType();</pre>
</div>
<p>如果当前程序集是可运行的，则设置一个程序入口，</p>
<div class="cnblogs_code">
<pre><span style="color: #008080;">1</span> <span style="color: #008000;">//</span><span style="color: #008000;"> set entry point for this assembly</span>
<span style="color: #008080;">2</span> assemblyBuilder.SetEntryPoint(helloKittyClassType.GetMethod(<span style="color: #800000;">"</span><span style="color: #800000;">SayHelloMethod</span><span style="color: #800000;">"</span>));</pre>
</div>
<p>将动态生成的程序集保存成磁盘文件，</p>
<div class="cnblogs_code">
<pre><span style="color: #008080;">1</span> <span style="color: #008000;">//</span><span style="color: #008000;"> save assembly</span>
<span style="color: #008080;">2</span> assemblyBuilder.Save(<span style="color: #800000;">"</span><span style="color: #800000;">Kitty.exe</span><span style="color: #800000;">"</span>);</pre>
</div>
<p>此时，通过反编译工具，将Kitty.exe反编译成代码，</p>
<div class="cnblogs_code"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/copycode.gif" alt="复制代码"></a></span></div>
<pre><span style="color: #008080;"> 1</span> <span style="color: #0000ff;">using</span><span style="color: #000000;"> System;
</span><span style="color: #008080;"> 2</span> 
<span style="color: #008080;"> 3</span> <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span><span style="color: #000000;"> HelloKittyClass
</span><span style="color: #008080;"> 4</span> <span style="color: #000000;">{
</span><span style="color: #008080;"> 5</span>   <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span><span style="color: #000000;"> SayHelloMethod()
</span><span style="color: #008080;"> 6</span> <span style="color: #000000;">  {
</span><span style="color: #008080;"> 7</span>     Console.WriteLine(<span style="color: #800000;">"</span><span style="color: #800000;">Hello, Kitty!</span><span style="color: #800000;">"</span><span style="color: #000000;">);
</span><span style="color: #008080;"> 8</span> <span style="color: #000000;">    Console.ReadLine();
</span><span style="color: #008080;"> 9</span> <span style="color: #000000;">  }
</span><span style="color: #008080;">10</span> }</pre>
<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/copycode.gif" alt="复制代码"></a></span></div></div>
<p>运行结果，<br><img src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/01142217-c7cf053609504c759a50724d935dc57c.png" alt="" width="614" height="128"></p>
<h2>完整代码</h2>
<div class="cnblogs_code"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/copycode.gif" alt="复制代码"></a></span></div>
<pre><span style="color: #008080;"> 1</span> <span style="color: #0000ff;">using</span><span style="color: #000000;"> System;
</span><span style="color: #008080;"> 2</span> <span style="color: #0000ff;">using</span><span style="color: #000000;"> System.Reflection;
</span><span style="color: #008080;"> 3</span> <span style="color: #0000ff;">using</span><span style="color: #000000;"> System.Reflection.Emit;
</span><span style="color: #008080;"> 4</span> 
<span style="color: #008080;"> 5</span> <span style="color: #0000ff;">namespace</span><span style="color: #000000;"> EmitIntroduction
</span><span style="color: #008080;"> 6</span> <span style="color: #000000;">{
</span><span style="color: #008080;"> 7</span>   <span style="color: #0000ff;">class</span><span style="color: #000000;"> Program
</span><span style="color: #008080;"> 8</span> <span style="color: #000000;">  {
</span><span style="color: #008080;"> 9</span>     <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> Main(<span style="color: #0000ff;">string</span><span style="color: #000000;">[] args)
</span><span style="color: #008080;">10</span> <span style="color: #000000;">    {
</span><span style="color: #008080;">11</span>       <span style="color: #008000;">//</span><span style="color: #008000;"> specify a new assembly name</span>
<span style="color: #008080;">12</span>       <span style="color: #0000ff;">var</span> assemblyName = <span style="color: #0000ff;">new</span> AssemblyName(<span style="color: #800000;">"</span><span style="color: #800000;">Kitty</span><span style="color: #800000;">"</span><span style="color: #000000;">);
</span><span style="color: #008080;">13</span> 
<span style="color: #008080;">14</span>       <span style="color: #008000;">//</span><span style="color: #008000;"> create assembly builder</span>
<span style="color: #008080;">15</span>       <span style="color: #0000ff;">var</span> assemblyBuilder =<span style="color: #000000;"> AppDomain.CurrentDomain
</span><span style="color: #008080;">16</span> <span style="color: #000000;">        .DefineDynamicAssembly(assemblyName, 
</span><span style="color: #008080;">17</span> <span style="color: #000000;">          AssemblyBuilderAccess.RunAndSave);
</span><span style="color: #008080;">18</span> 
<span style="color: #008080;">19</span>       <span style="color: #008000;">//</span><span style="color: #008000;"> create module builder</span>
<span style="color: #008080;">20</span>       <span style="color: #0000ff;">var</span> moduleBuilder = 
<span style="color: #008080;">21</span> <span style="color: #000000;">        assemblyBuilder.DefineDynamicModule(
</span><span style="color: #008080;">22</span>           <span style="color: #800000;">"</span><span style="color: #800000;">KittyModule</span><span style="color: #800000;">"</span>, <span style="color: #800000;">"</span><span style="color: #800000;">Kitty.exe</span><span style="color: #800000;">"</span><span style="color: #000000;">);
</span><span style="color: #008080;">23</span> 
<span style="color: #008080;">24</span>       <span style="color: #008000;">//</span><span style="color: #008000;"> create type builder for a class</span>
<span style="color: #008080;">25</span>       <span style="color: #0000ff;">var</span> typeBuilder = 
<span style="color: #008080;">26</span> <span style="color: #000000;">        moduleBuilder.DefineType(
</span><span style="color: #008080;">27</span>           <span style="color: #800000;">"</span><span style="color: #800000;">HelloKittyClass</span><span style="color: #800000;">"</span><span style="color: #000000;">, TypeAttributes.Public);
</span><span style="color: #008080;">28</span> 
<span style="color: #008080;">29</span>       <span style="color: #008000;">//</span><span style="color: #008000;"> create method builder</span>
<span style="color: #008080;">30</span>       <span style="color: #0000ff;">var</span> methodBuilder =<span style="color: #000000;"> typeBuilder.DefineMethod(
</span><span style="color: #008080;">31</span>         <span style="color: #800000;">"</span><span style="color: #800000;">SayHelloMethod</span><span style="color: #800000;">"</span><span style="color: #000000;">,
</span><span style="color: #008080;">32</span>         MethodAttributes.Public |<span style="color: #000000;"> MethodAttributes.Static,
</span><span style="color: #008080;">33</span>         <span style="color: #0000ff;">null</span><span style="color: #000000;">,
</span><span style="color: #008080;">34</span>         <span style="color: #0000ff;">null</span><span style="color: #000000;">);
</span><span style="color: #008080;">35</span> 
<span style="color: #008080;">36</span>       <span style="color: #008000;">//</span><span style="color: #008000;"> then get the method il generator</span>
<span style="color: #008080;">37</span>       <span style="color: #0000ff;">var</span> il =<span style="color: #000000;"> methodBuilder.GetILGenerator();
</span><span style="color: #008080;">38</span> 
<span style="color: #008080;">39</span>       <span style="color: #008000;">//</span><span style="color: #008000;"> then create the method function</span>
<span style="color: #008080;">40</span>       il.Emit(OpCodes.Ldstr, <span style="color: #800000;">"</span><span style="color: #800000;">Hello, Kitty!</span><span style="color: #800000;">"</span><span style="color: #000000;">);
</span><span style="color: #008080;">41</span> <span style="color: #000000;">      il.Emit(OpCodes.Call, 
</span><span style="color: #008080;">42</span>         <span style="color: #0000ff;">typeof</span><span style="color: #000000;">(Console).GetMethod(
</span><span style="color: #008080;">43</span>         <span style="color: #800000;">"</span><span style="color: #800000;">WriteLine</span><span style="color: #800000;">"</span>, <span style="color: #0000ff;">new</span> Type[] { <span style="color: #0000ff;">typeof</span>(<span style="color: #0000ff;">string</span><span style="color: #000000;">) }));
</span><span style="color: #008080;">44</span> <span style="color: #000000;">      il.Emit(OpCodes.Call, 
</span><span style="color: #008080;">45</span>         <span style="color: #0000ff;">typeof</span>(Console).GetMethod(<span style="color: #800000;">"</span><span style="color: #800000;">ReadLine</span><span style="color: #800000;">"</span><span style="color: #000000;">));
</span><span style="color: #008080;">46</span>       il.Emit(OpCodes.Pop); <span style="color: #008000;">//</span><span style="color: #008000;"> we just read something here, throw it.</span>
<span style="color: #008080;">47</span> <span style="color: #000000;">      il.Emit(OpCodes.Ret);
</span><span style="color: #008080;">48</span> 
<span style="color: #008080;">49</span>       <span style="color: #008000;">//</span><span style="color: #008000;"> then create the whole class type</span>
<span style="color: #008080;">50</span>       <span style="color: #0000ff;">var</span> helloKittyClassType =<span style="color: #000000;"> typeBuilder.CreateType();
</span><span style="color: #008080;">51</span> 
<span style="color: #008080;">52</span>       <span style="color: #008000;">//</span><span style="color: #008000;"> set entry point for this assembly</span>
<span style="color: #008080;">53</span> <span style="color: #000000;">      assemblyBuilder.SetEntryPoint(
</span><span style="color: #008080;">54</span>         helloKittyClassType.GetMethod(<span style="color: #800000;">"</span><span style="color: #800000;">SayHelloMethod</span><span style="color: #800000;">"</span><span style="color: #000000;">));
</span><span style="color: #008080;">55</span> 
<span style="color: #008080;">56</span>       <span style="color: #008000;">//</span><span style="color: #008000;"> save assembly</span>
<span style="color: #008080;">57</span>       assemblyBuilder.Save(<span style="color: #800000;">"</span><span style="color: #800000;">Kitty.exe</span><span style="color: #800000;">"</span><span style="color: #000000;">);
</span><span style="color: #008080;">58</span> 
<span style="color: #008080;">59</span> <span style="color: #000000;">      Console.WriteLine(
</span><span style="color: #008080;">60</span>         <span style="color: #800000;">"</span><span style="color: #800000;">Hi, Dennis, a Kitty assembly has been generated for you.</span><span style="color: #800000;">"</span><span style="color: #000000;">);
</span><span style="color: #008080;">61</span> <span style="color: #000000;">      Console.ReadLine();
</span><span style="color: #008080;">62</span> <span style="color: #000000;">    }
</span><span style="color: #008080;">63</span> <span style="color: #000000;">  }
</span><span style="color: #008080;">64</span> }</pre>
<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/copycode.gif" alt="复制代码"></a></span></div></div>
<p><a style="line-height: 1.5;" href="https://github.com/gaochundong/LearningEmit">下载完整代码</a></p>
<p><a href="http://www.cnblogs.com/gaochundong/archive/2013/06/01/csharp_emit_create_constructor_properties.html">进一步阅读使用Emit生成构造函数和属性</a></p></div><div id="MySignature"></div>
<div class="clear"></div>
<div id="blog_post_info_block">
<div id="BlogPostCategory"></div>
<div id="EntryTag">标签: <a href="http://www.cnblogs.com/gaochundong/tag/C%23/">C#</a>, <a href="http://www.cnblogs.com/gaochundong/tag/.NET/">.NET</a>, <a href="http://www.cnblogs.com/gaochundong/tag/Emit/">Emit</a>, <a href="http://www.cnblogs.com/gaochundong/tag/Reflection/">Reflection</a></div>
<div id="blog_post_info"><div id="green_channel">
绿色通道：
<a href="javascript:void(0);" id="green_channel_digg" onclick="DiggIt(3112432,cb_blogId,1);green_channel_success(this,&#39;谢谢推荐！&#39;);">好文要顶</a>
<a id="green_channel_follow" href="javascript:void(0);">已关注</a>
<a id="green_channel_favorite" onclick="AddToWz(cb_entryId);return false;" href="javascript:void(0);">收藏该文</a><a id="green_channel_contact" href="http://space.cnblogs.com/msg/send/Dennis+Gao" target="_blank">与我联系</a>
<a id="green_channel_weibo" href="javascript:void(0);" title="分享至新浪微博" onclick="ShareToTsina()"><img src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/icon_weibo_24.png" alt=""></a>
</div>
<div id="author_profile">
<div id="author_profile_info" class="author_profile_info">
<a href="http://home.cnblogs.com/u/gaochundong/" target="_blank"><img src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/20130330200353.png" class="author_avatar" alt=""></a>
<div id="author_profile_detail" class="author_profile_info">
<a href="http://home.cnblogs.com/u/gaochundong/">Dennis Gao</a><br>
<a href="http://home.cnblogs.com/u/gaochundong/followees">关注 - 29</a><br>
<a href="http://home.cnblogs.com/u/gaochundong/followers">粉丝 - 759</a>
</div>
</div>
<div class="clear"></div>
<div id="author_profile_honor">荣誉：<a href="http://www.cnblogs.com/expert/" target="_blank">推荐博客</a></div>
<div id="author_profile_follow">
    我在关注他 <a href="javascript:void(0);" onclick="remove_follow();">取消关注</a>
</div>
</div>
<div id="div_digg">										
    <div class="diggit" onclick="votePost(3112432,&#39;Digg&#39;)">
        <span class="diggnum" id="digg_count">1</span>
    </div>
	<div class="buryit" onclick="votePost(3112432,&#39;Bury&#39;)"> 
		<span class="burynum" id="bury_count">0</span>
	</div>
	<div class="clear"></div>	
	<div class="diggword" id="digg_tips">
    (请您对文章做出评价)
    </div>	
</div>
</div>
<div class="clear"></div>
<div id="post_next_prev"><a href="http://www.cnblogs.com/gaochundong/archive/2013/05/22/3092796.html" class="p_n_p_prefix">« </a> 上一篇：<a href="http://www.cnblogs.com/gaochundong/archive/2013/05/22/3092796.html" title="发布于2013-05-22 15:11">NSubstitute完全手册索引</a><br><a href="http://www.cnblogs.com/gaochundong/archive/2013/06/01/3112444.html" class="p_n_p_prefix">» </a> 下一篇：<a href="http://www.cnblogs.com/gaochundong/archive/2013/06/01/3112444.html" title="发布于2013-06-01 16:07">C#使用Emit生成构造函数和属性</a><br></div>
</div>


		</div>
		<div class="postDesc">posted @ <span id="post-date">2013-06-01 14:28</span> <a href="http://www.cnblogs.com/gaochundong/">Dennis Gao</a> 阅读(<span id="post_view_count">682</span>) 评论(<span id="post_comment_count">2</span>)  <a href="http://i.cnblogs.com/EditPosts.aspx?postid=3112432" rel="nofollow">编辑</a> <a href="http://www.cnblogs.com/gaochundong/archive/2013/06/01/csharp_emit_generate_assembly.html#" onclick="AddToWz(3112432);return false;">收藏</a></div>
	</div>
	<script type="text/javascript">var allowComments=true,isLogined=true,cb_blogId=77744,cb_entryId=3112432,cb_blogApp=currentBlogApp,cb_blogUserGuid='01e7fb75-bbe0-df11-ac81-842b2b196315',cb_entryCreatedDate='2013/6/1 14:28:00';loadViewCount(cb_entryId);</script>
	
</div><!--end: topics 文章、评论容器-->
<a name="!comments"></a><div id="blog-comments-placeholder"><div id="comments_pager_top"></div>
<br>
<div class="feedback_area_title">评论列表</div>
<div class="feedbackNoItems"></div>	

		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"><a href="javascript:void(0);" onclick="return ReplyComment(2756820,&#39;ICkPnevN0i6jEkaWqd6HBgMYhcNUnDT+TGKPOk3nOJtSDMuPQ60HSQ==&#39;)">回复</a><a href="javascript:void(0);" onclick="return QuoteComment(2756820,&#39;ICkPnevN0i6jEkaWqd6HBgMYhcNUnDT+TGKPOk3nOJtSDMuPQ60HSQ==&#39;)">引用</a></span>
				</div>
				<a href="http://www.cnblogs.com/gaochundong/archive/2013/06/01/csharp_emit_generate_assembly.html#2756820" class="layer">#1楼</a><a name="2756820" id="comment_anchor_2756820"></a>  <span class="comment_date">2013-08-21 13:17</span> <a id="a_comment_author_2756820" href="http://www.cnblogs.com/yueyue184/" target="_blank">Red Cat</a> <a href="http://msg.cnblogs.com/msg/send/Red+Cat" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2756820" class="blog_comment_body">感觉这样做插件比较不错。</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2756820,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2756820,&#39;Bury&#39;,this)">反对(0)</a></div><span id="comment_2756820_avatar" style="display:none;">http://pic.cnitblog.com/face/u207524.jpg?id=19133127</span>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"><a href="javascript:void(0);" onclick="return ReplyComment(2919977,&#39;4LImr7Ju4bZlbT66xIJIZar0zf1M5BOpplZXKD29JPFnjtgvdHd9zA==&#39;)">回复</a><a href="javascript:void(0);" onclick="return QuoteComment(2919977,&#39;4LImr7Ju4bZlbT66xIJIZar0zf1M5BOpplZXKD29JPFnjtgvdHd9zA==&#39;)">引用</a></span>
				</div>
				<a href="http://www.cnblogs.com/gaochundong/archive/2013/06/01/csharp_emit_generate_assembly.html#2919977" class="layer">#2楼</a><a name="2919977" id="comment_anchor_2919977"></a><span id="comment-maxId" style="display:none;">2919977</span><span id="comment-maxDate" style="display:none;">2014/4/17 16:19:18</span>  <span class="comment_date">2014-04-17 16:19</span> <a id="a_comment_author_2919977" href="http://www.cnblogs.com/rohelm/" target="_blank">Halower</a> <a href="http://msg.cnblogs.com/msg/send/Halower" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2919977" class="blog_comment_body">赞一个</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2919977,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2919977,&#39;Bury&#39;,this)">反对(0)</a></div><span id="comment_2919977_avatar" style="display:none;">http://pic.cnitblog.com/face/360406/20130713163629.png</span>
			</div>
		</div>
	<div id="comments_pager_bottom"></div></div><script type="text/javascript">var commentManager = new blogCommentManager();commentManager.renderComments(0);</script>
<div id="comment_form" class="commentform">
<a name="commentform"></a>
<div id="divCommentShow"></div>
<div id="comment_nav"><span id="span_refresh_tips"></span><a href="javascript:void(0);" id="lnk_RefreshComments" onclick="return RefreshCommentList();">刷新评论</a><a href="http://www.cnblogs.com/gaochundong/archive/2013/06/01/csharp_emit_generate_assembly.html#" onclick="return RefreshPage();">刷新页面</a><a href="http://www.cnblogs.com/gaochundong/archive/2013/06/01/csharp_emit_generate_assembly.html#top">返回顶部</a></div>
<div id="comment_form_container"><div id="commentform_title">发表评论</div>
<span id="tip_comment" style="color:Red"></span>
<p>
昵称：<input type="text" id="tbCommentAuthor" class="author" disabled="disabled" size="50" value="window5549-accp">
</p>
<div class="commentbox_main">
<div class="commentbox_title">
<div class="commentbox_title_left">评论内容：</div>
<div class="commentbox_title_right">
<img id="ubb_quote" class="comment_icon" src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/quote.gif" alt="引用" title="添加引用" onclick="insertUBB(&#39;tbCommentBody&#39;,&#39;quote&#39;)">
<img id="ubb_bold" class="comment_icon" src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/b.png" alt="粗体" title="添加粗体" onclick="insertUBB(&#39;tbCommentBody&#39;,&#39;b&#39;)">
<img id="ubb_url" class="comment_icon" src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/lk.png" alt="链接" title="添加链接" onclick="insertUbbUrl(&#39;tbCommentBody&#39;)">
<img id="ubb_indent" class="comment_icon" src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/indent.png" alt="缩进" title="添加首行缩进" onclick="insertIndent(&#39;tbCommentBody&#39;)">
<img id="ubb_code" class="comment_icon" src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/InsertCode.gif" alt="代码" title="添加代码" onclick="insertUbbCode()">
<img id="ubb_img" class="comment_icon" src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/img.gif" alt="图片" title="上传图片" onclick="OpenImageUploadWindow();">
</div>
</div>
<div class="clear"></div>
<textarea id="tbCommentBody" class="comment_textarea" rows="20" cols="50"></textarea>
</div>
<p id="commentbox_opt">
<input id="btn_comment_submit" type="button" class="comment_btn" value="提交评论">
<span id="span_comment_canceledit" style="display:none"><a href="javascript:void(0);" onclick="return CancelCommentEdit()">不改了</a></span>
<a href="javascript:void(0);" onclick="return logout();">注销</a>
        <a id="commentbox_opt_sub" href="javascript:void(0);" title="订阅后有新评论时会邮件通知您" onclick="commentManager.Subscribe()">订阅评论</a>
</p>
<p>
[使用Ctrl+Enter键快速提交]
</p>
<div style="display:none">
<span id="comment_edit_id"></span><span id="span_parentcomment_id"></span>
<span id="span_parent_id"></span>
<span id="span_comment_replyto"></span>
<span id="span_comment_posted"></span>
</div>
</div>
<div class="ad_text_commentbox" id="ad_text_under_commentbox"></div>
<div id="site_nav_under"><a href="http://www.imooc.com/view/158?from=cnblogs" target="_blank"><b>【免费课程】系列： Maya3D建模攻略——葵花宝典     </b></a><br><a href="http://zt.cnblogs.com/tingyun/" target="_blank">听云APP性能监测——终结移动App性能黑洞</a><br><a href="http://oneapm.com/events/ironman.html?hmsr=%E5%8D%9A%E5%AE%A2%E5%9B%AD&hmmd=%E6%96%87%E7%AB%A0%E5%86%85%E9%A1%B5%E6%96%87%E5%AD%97%E9%93%BE&hmpl=&hmkw=&hmci=" target="_blank">100%有礼！机械键盘、钢铁侠T恤免费拿！OneAPM送福利！</a><br><a href="http://www.rongcloud.cn/promotion/" target="_blank">融云，免费为你的App加入IM功能——让你的App“聊”起来！！</a></div>
<div id="opt_under_post"></div>
<script type="text/javascript">
    var enableGoogleAd = canShowAdsense(); var googletag = googletag || {}; googletag.cmd = googletag.cmd || [];
    fixPostBodyFormat();
</script>
<div id="ad_under_post_holder">
<script type="text/javascript">
    var googletag = googletag || {};
    googletag.cmd = googletag.cmd || [];
    (function () {
        if (enableGoogleAd) {
            var gads = document.createElement('script');
            gads.async = true;
            gads.type = 'text/javascript';
            var useSSL = 'https:' == document.location.protocol;
            gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js';
            var node = document.getElementsByTagName('script')[0];
            node.parentNode.insertBefore(gads, node);
        }
    })();
</script>
<script type="text/javascript">
    try {
        if (enableGoogleAd) {
            googletag.cmd.push(function () {
                googletag.defineSlot('/1090369/cnblogs_blogpost_C1_sitehome', [300, 250], 'div-gpt-ad-1346480159711-0').addService(googletag.pubads());
                googletag.defineSlot('/1090369/cnblogs_blogpost_C2', [468, 60], 'div-gpt-ad-1410860226396-0').addService(googletag.pubads());
                googletag.pubads().enableSingleRequest();
                googletag.enableServices();
            });
        };
    } catch (e) { }
</script>
<div id="google_ad_c1" class="c_ad_block">
    <div id="div-gpt-ad-1346480159711-0" style="width:300px; height:250px;">
    <script type="text/javascript">
        try {
            if (enableGoogleAd) {
                googletag.cmd.push(function () { googletag.display('div-gpt-ad-1346480159711-0'); });            
            } else {
                $('#div-gpt-ad-1346480159711-0').hide();
            }
    } catch (e) { }
    </script>
    <div id="google_ads_iframe_/1090369/cnblogs_blogpost_C1_sitehome_0__container__" style="border: 0pt none;"><iframe id="google_ads_iframe_/1090369/cnblogs_blogpost_C1_sitehome_0" name="google_ads_iframe_/1090369/cnblogs_blogpost_C1_sitehome_0" width="300" height="250" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" src="javascript:"<html><body style='background:transparent'></body></html>"" style="border: 0px; vertical-align: bottom;"></iframe></div><iframe id="google_ads_iframe_/1090369/cnblogs_blogpost_C1_sitehome_0__hidden__" name="google_ads_iframe_/1090369/cnblogs_blogpost_C1_sitehome_0__hidden__" width="0" height="0" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" src="javascript:"<html><body style='background:transparent'></body></html>"" style="border: 0px; vertical-align: bottom; visibility: hidden; display: none;"></iframe></div>
</div>
</div>
<div id="under_post_news"><div class="itnews c_ad_block"><b>最新IT新闻</b>:<br> ·  <a href="http://news.cnblogs.com/n/504720/" target="_blank">传苹果Mac mini将10月与新iPad同步上市</a><br> ·  <a href="http://news.cnblogs.com/n/504719/" target="_blank">不要高薪，15 位年薪只领1美元的企业CEO</a><br> ·  <a href="http://news.cnblogs.com/n/504717/" target="_blank">可伸缩NoSQL数据库的五条建议</a><br> ·  <a href="http://news.cnblogs.com/n/504716/" target="_blank">风投疯狂烧钱：科技创业没有泡沫 只有狂热</a><br> ·  <a href="http://news.cnblogs.com/n/504714/" target="_blank">娱乐贴！4个事实证明蓝翔已完胜清华</a><br>» <a href="http://news.cnblogs.com/" title="IT新闻" target="_blank">更多新闻...</a></div></div>
<div id="google_ad_c2" class="c_ad_block">
<div id="div-gpt-ad-1410860226396-0" style="width:468px; height:60px;">
<script type="text/javascript">
try {
    if (enableGoogleAd) {
        googletag.cmd.push(function () { googletag.display('div-gpt-ad-1410860226396-0'); });
    } else {
        $('#div-gpt-ad-1346480159711-0').hide();
    }
} catch (e) { }
</script>
<div id="google_ads_iframe_/1090369/cnblogs_blogpost_C2_0__container__" style="border: 0pt none;"><iframe id="google_ads_iframe_/1090369/cnblogs_blogpost_C2_0" name="google_ads_iframe_/1090369/cnblogs_blogpost_C2_0" width="468" height="60" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" src="javascript:"<html><body style='background:transparent'></body></html>"" style="border: 0px; vertical-align: bottom;"></iframe></div></div>
</div>
<div id="under_post_kb"><div class="itnews c_ad_block" id="kb_block"><b>最新知识库文章</b>:<br><div id="kb_recent"> ·  <a href="http://kb.cnblogs.com/page/504518/" target="_blank">构建高可伸缩性的WEB交互式系统（下）</a><br> ·  <a href="http://kb.cnblogs.com/page/504459/" target="_blank">谈谈网站测试中的AB测试方法</a><br> ·  <a href="http://kb.cnblogs.com/page/504453/" target="_blank">你在支配钱，还是钱在支配你？</a><br> ·  <a href="http://kb.cnblogs.com/page/504360/" target="_blank">关于技术变化方面的五种思想</a><br> ·  <a href="http://kb.cnblogs.com/page/504228/" target="_blank">图解SSL/TLS协议</a><br></div>» <a href="http://kb.cnblogs.com/" target="_blank">更多知识库文章...</a></div></div>
<div id="HistoryToday" class="c_ad_block"></div>
<script type="text/javascript">
$(function () {
    loadNewsAndKb();
    loadBlogSignature();
    LoadPostInfoBlock(cb_blogId, cb_entryId, cb_blogApp, cb_blogUserGuid);
    GetPrevNextPost(cb_entryId, cb_blogId, cb_entryCreatedDate);
    loadOptUnderPost();
    GetHistoryToday(cb_blogId, cb_blogApp, cb_entryCreatedDate);
    setTimeout(function () { incrementViewCount(cb_entryId); }, 200);
});
</script>
</div>

	</div><!--end: forFlow -->
	</div><!--end: mainContent 主体内容容器-->

	<div id="sideBar">
		<div id="sideBarMain">
			
<!--done-->
<div class="newsItem">
<h3 class="catListTitle">公告</h3>
	<div id="blog-news"><div align="center"><a href="http://www.revolvermaps.com/?target=enlarge&i=21a8az00pq9&color=ff0000&m=0"><img src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/21a8az00pq9.png" width="192" height="96" alt="Map" style="border: 0px;"></a></div>

<div align="center">UV:<a href="http://www.amazingcounters.com/"><img border="0" src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/counter.php" alt="AmazingCounters.com"></a></div><div id="profile_block">昵称：<a href="http://home.cnblogs.com/u/gaochundong/">Dennis Gao</a><br>园龄：<a href="http://home.cnblogs.com/u/gaochundong/" title="入园时间：2010-10-26">3年11个月</a><br>荣誉：<a href="http://www.cnblogs.com/expert/">推荐博客</a><br>粉丝：<a href="http://home.cnblogs.com/u/gaochundong/followers/">759</a><br>关注：<a href="http://home.cnblogs.com/u/gaochundong/followees/">29</a><div id="p_b_follow">已关注 <a href="javascript:void(0);" onclick="cnblogs.UserManager.RemoveFlow(&#39;01e7fb75-bbe0-df11-ac81-842b2b196315&#39;)">-取消</a></div></div></div><script type="text/javascript">loadBlogNews();</script>
</div>

			<div id="blog-calendar" style="display:none"></div><script type="text/javascript">loadBlogDefaultCalendar();</script>
			
			<div id="leftcontentcontainer">
				<div id="blog-sidecolumn">
<div class="catListTag">
<h3 class="catListTitle">我的标签</h3>
<ul>
<li><a href="http://www.cnblogs.com/gaochundong/tag/C%23/">C#</a>(69)</li><li><a href="http://www.cnblogs.com/gaochundong/tag/.NET/">.NET</a>(44)</li><li><a href="http://www.cnblogs.com/gaochundong/tag/Design%20Pattern/">Design Pattern</a>(43)</li><li><a href="http://www.cnblogs.com/gaochundong/tag/Unit%20Testing/">Unit Testing</a>(29)</li><li><a href="http://www.cnblogs.com/gaochundong/tag/NSubstitute/">NSubstitute</a>(23)</li><li><a href="http://www.cnblogs.com/gaochundong/tag/Behavioral%20Patterns/">Behavioral Patterns</a>(14)</li><li><a href="http://www.cnblogs.com/gaochundong/tag/Dependency%20Injection/">Dependency Injection</a>(12)</li><li><a href="http://www.cnblogs.com/gaochundong/tag/Database/">Database</a>(11)</li><li><a href="http://www.cnblogs.com/gaochundong/tag/Inversion%20of%20Control/">Inversion of Control</a>(11)</li><li><a href="http://www.cnblogs.com/gaochundong/tag/Algorithm/">Algorithm</a>(11)</li><li><a href="http://www.cnblogs.com/gaochundong/tag/">更多</a></li>
</ul>
</div>

<div class="catListBlogRank">
<h3 class="catListTitle">积分与排名</h3>
<ul>
	<li class="liScore">
		积分 -	146194
	</li>
	<li class="liRank">
		排名 -	877
	</li>
</ul>
</div>


<div id="recent_comments_wrap">
<div class="catListComment">
<h3 class="catListTitle">最新评论</h3>

	<div id="RecentCommentsBlock"><ul>
    <li class="recent_comment_title"><a href="http://www.cnblogs.com/gaochundong/p/binary_heap.html#3033847">1. Re:二叉堆</a></li>
    <li class="recent_comment_body">楼主<br>最大堆调整（Max-Heapify）：。运行时间为 O(lg n)。<br>创建最大堆（Build-Max-Heap）： O(n)。<br>堆排序（HeapSort）：O(lg n)。<br><br>这是怎么算出来的，简单说下嘛？</li>
    <li class="recent_comment_author">--koi</li>
    <li class="recent_comment_title"><a href="http://www.cnblogs.com/gaochundong/p/data_structures_and_asymptotic_analysis.html#3033244">2. Re:常用数据结构及复杂度</a></li>
    <li class="recent_comment_body">mark</li>
    <li class="recent_comment_author">--取个牛逼的名字真难</li>
    <li class="recent_comment_title"><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/24/csharp_binary_tree.html#3031746">3. Re:你曾实现过二叉树吗</a></li>
    <li class="recent_comment_body">这个遍历怎么像是前序遍历,不像中序遍历.</li>
    <li class="recent_comment_author">--道&amp;lt;=&amp;gt;图灵</li>
    <li class="recent_comment_title"><a href="http://www.cnblogs.com/gaochundong/p/complexity_of_algorithms.html#3031549">4. Re:算法复杂度分析</a></li>
    <li class="recent_comment_body">博主求转载(๑╹∀╹๑)</li>
    <li class="recent_comment_author">--DIYgod</li>
    <li class="recent_comment_title"><a href="http://www.cnblogs.com/gaochundong/p/binary_heap.html#3030624">5. Re:二叉堆</a></li>
    <li class="recent_comment_body">@过期明信片呵呵，面试笔试不考这些玩意儿，我自己折腾着玩的。你要面 .NET 相关职位，只要搞定 CLR via C# 就可以了。...</li>
    <li class="recent_comment_author">--Dennis Gao</li>
    <li class="recent_comment_title"><a href="http://www.cnblogs.com/gaochundong/p/binary_heap.html#3030255">6. Re:二叉堆</a></li>
    <li class="recent_comment_body">又来膜拜大神了,能否发些面试系列?</li>
    <li class="recent_comment_author">--过期明信片</li>
    <li class="recent_comment_title"><a href="http://www.cnblogs.com/gaochundong/p/binary_heap.html#3030045">7. Re:二叉堆</a></li>
    <li class="recent_comment_body"><a href="http://www.cnblogs.com/gaochundong/archive/2013/06/01/csharp_emit_generate_assembly.html#3029976" title="查看所回复的评论" onclick="commentManager.renderComments(0,50,3029976);">@</a>ACP<br>温故而知新，感谢支持！</li>
    <li class="recent_comment_author">--Dennis Gao</li>
    <li class="recent_comment_title"><a href="http://www.cnblogs.com/gaochundong/p/binary_heap.html#3029976">8. Re:二叉堆</a></li>
    <li class="recent_comment_body">楼主辛苦了，学习了，非常感谢！</li>
    <li class="recent_comment_author">--ACP</li>
    <li class="recent_comment_title"><a href="http://www.cnblogs.com/gaochundong/p/consistent_hashing.html#3028112">9. Re:一致性哈希</a></li>
    <li class="recent_comment_body"><a href="http://www.cnblogs.com/gaochundong/archive/2013/06/01/csharp_emit_generate_assembly.html#3027349" title="查看所回复的评论" onclick="commentManager.renderComments(0,50,3027349);">@</a>Dennis Gao<br>谢谢。</li>
    <li class="recent_comment_author">--p.yl</li>
    <li class="recent_comment_title"><a href="http://www.cnblogs.com/gaochundong/p/consistent_hashing.html#3027349">10. Re:一致性哈希</a></li>
    <li class="recent_comment_body"><a href="http://www.cnblogs.com/gaochundong/archive/2013/06/01/csharp_emit_generate_assembly.html#3026648" title="查看所回复的评论" onclick="commentManager.renderComments(0,50,3026648);">@</a>p.yl<br>使用的 iMetro_HD 模板，然后使用 CSS 修改成自己喜欢的颜色。</li>
    <li class="recent_comment_author">--Dennis Gao</li>
</ul>
</div>
</div>
</div><div id="topview_posts_wrap">
<div class="catListView">
<h3 class="catListTitle">阅读排行榜</h3>
	<div id="TopViewPostsBlock"><ul><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/06/03/practice_to_write_better_csharp_code.html">1. 编写更好的C#代码(15768)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/opensource_ip_video_surveillance_system_part_1_introduction.html">2. 开源倾情奉献：基于.NET打造IP智能网络视频监控系统（一）开放源代码(12561)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/net4_memory_leak_of_cocurrent_queue.html">3. 那些年黑了你的微软BUG(11720)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/data_structures_and_asymptotic_analysis.html">4. 常用数据结构及复杂度(9996)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/csharp_mjpeg_streaming.html">5. C#开源实现MJPEG流传输(7415)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/05/09/i_am_a_bad_software_developer.html">6. 我是一个垃圾程序员(6414)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/14/csharp_async_tcp_server.html">7. C#异步TCP服务器完整实现(4842)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/windbg_cheat_sheet.html">8. WinDbg 命令三部曲：（一）WinDbg 命令手册(4500)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/11/dotnet_csharp_ip_video_surveillance.html">9. 基于.NET打造IP智能网络视频监控系统(4297)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/opensource_ip_video_surveillance_system_part_2_foundation.html">10. 开源倾情奉献：基于.NET打造IP智能网络视频监控系统（二）基础类库介绍(3656)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/lambda_design_patterns.html">11. Lambda应用设计模式(3643)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/entity_framework_bulk_insert_extension.html">12. EntityFramework中支持BulkInsert扩展(3506)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/14/csharp_udp_datagram_splitter.html">13. C#实现UDP分包组包(3174)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/24/csharp_file_database.html">14. C#实现文件数据库(3040)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/way_to_lambda.html">15. Lambda表达式的前世今生(2972)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/opensource_ip_video_surveillance_system_part_5_client_side.html">16. 开源倾情奉献：基于.NET打造IP智能网络视频监控系统（五）客户端介绍(2899)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/visual_studio_2013_new_feature_memory_dump_analysis.html">17. Visual Studio 2013 新功能 Memory Dump 分析器(2805)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/opensource_ip_video_surveillance_system_part_4_service_side.html">18. 开源倾情奉献：基于.NET打造IP智能网络视频监控系统（四）服务端介绍(2741)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/13/csharp_rtp_rfc3550.html">19. C#实现RTP数据包传输(2575)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/18/wpf_mvvm_async_waiting_view.html">20. WPF异步MVVM等待窗体(2200)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/06/09/entityframework_usage_transaction_scope.html">21. EntityFramework用法探索（八）事务处理(2146)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/06/01/aop_interception_with_unity.html">22. 使用Unity进行AOP对象拦截(2000)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/opensource_ip_video_surveillance_system_part_3_commandline.html">23. 开源倾情奉献：基于.NET打造IP智能网络视频监控系统（三）命令行工具集(1998)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/12/service_locator_pattern.html">24. Service Locator 模式(1936)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/24/csharp_binary_tree.html">25. 你曾实现过二叉树吗(1925)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/11/open_source_tail_tailui.html">26. C#开源文件实时监控工具Tail&amp;TailUI(1785)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/24/csharp_generate_mongodb_objectid.html">27. C#生成MongoDB中的ObjectId(1635)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/concurrent_dictionary_vs_dictionary_plus_locking.html">28. ConcurrentDictionary 对决 Dictionary+Locking(1624)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/14/csharp_async_tcp_client.html">29. C#对TCP客户端的状态封装(1594)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/agile_software_development_methodologies.html">30. 敏捷软件开发揭秘(1531)</a></li></ul></div>
</div>
</div><div id="topfeedback_posts_wrap">
<div class="catListFeedback">
<h3 class="catListTitle">评论排行榜</h3>
	<div id="TopFeedbackPostsBlock"><ul><li><a href="http://www.cnblogs.com/gaochundong/p/opensource_ip_video_surveillance_system_part_1_introduction.html">1. 开源倾情奉献：基于.NET打造IP智能网络视频监控系统（一）开放源代码(169)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/net4_memory_leak_of_cocurrent_queue.html">2. 那些年黑了你的微软BUG(108)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/06/03/practice_to_write_better_csharp_code.html">3. 编写更好的C#代码(91)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/data_structures_and_asymptotic_analysis.html">4. 常用数据结构及复杂度(67)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/05/09/i_am_a_bad_software_developer.html">5. 我是一个垃圾程序员(55)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/csharp_mjpeg_streaming.html">6. C#开源实现MJPEG流传输(49)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/lambda_design_patterns.html">7. Lambda应用设计模式(45)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/11/dotnet_csharp_ip_video_surveillance.html">8. 基于.NET打造IP智能网络视频监控系统(40)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/entity_framework_bulk_insert_extension.html">9. EntityFramework中支持BulkInsert扩展(31)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/14/csharp_async_tcp_server.html">10. C#异步TCP服务器完整实现(30)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/18/wpf_mvvm_async_waiting_view.html">11. WPF异步MVVM等待窗体(27)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/14/csharp_udp_datagram_splitter.html">12. C#实现UDP分包组包(26)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/windbg_cheat_sheet.html">13. WinDbg 命令三部曲：（一）WinDbg 命令手册(26)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/24/csharp_file_database.html">14. C#实现文件数据库(24)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/opensource_ip_video_surveillance_system_part_5_client_side.html">15. 开源倾情奉献：基于.NET打造IP智能网络视频监控系统（五）客户端介绍(17)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/visual_studio_2013_new_feature_memory_dump_analysis.html">16. Visual Studio 2013 新功能 Memory Dump 分析器(15)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/06/06/entityframework_usage_database_first.html">17. EntityFramework用法探索（一）DatabaseFirst(13)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/06/09/entityframework_usage_transaction_scope.html">18. EntityFramework用法探索（八）事务处理(13)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/type_and_typeinfo_new_faces_of_object_metadata.html">19. 在 .NET 4.5 中反射机制的变更(12)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/24/csharp_generate_mongodb_objectid.html">20. C#生成MongoDB中的ObjectId(12)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/14/csharp_async_tcp_client.html">21. C#对TCP客户端的状态封装(10)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/comparison_sorting_algorithms.html">22. 比较排序算法(10)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/way_to_lambda.html">23. Lambda表达式的前世今生(10)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/design_pattern_visitor.html">24. 设计模式之美：Visitor（访问者）(10)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/uml_association_aggregation_composition.html">25. UML中关联（Association）、聚合（Aggregation）和合成（Composition）之间的区别(9)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/liskov_substitution_principle.html">26. 里氏替换原则（Liskov Substitution Principle）(9)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/consistent_hashing.html">27. 一致性哈希(9)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/unit_test_with_microsoft_fakes.html">28. 使用 Microsoft Fakes 进行单元测试(8)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/opensource_ip_video_surveillance_system_part_2_foundation.html">29. 开源倾情奉献：基于.NET打造IP智能网络视频监控系统（二）基础类库介绍(8)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/24/csharp_binary_tree.html">30. 你曾实现过二叉树吗(7)</a></li></ul></div>
</div>
</div><div id="topdigg_posts_wrap">
<div class="catListView">
<h3 class="catListTitle">推荐排行榜</h3>
<div id="TopDiggPostsBlock"><ul><li><a href="http://www.cnblogs.com/gaochundong/p/opensource_ip_video_surveillance_system_part_1_introduction.html">1. 开源倾情奉献：基于.NET打造IP智能网络视频监控系统（一）开放源代码(156)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/data_structures_and_asymptotic_analysis.html">2. 常用数据结构及复杂度(142)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/net4_memory_leak_of_cocurrent_queue.html">3. 那些年黑了你的微软BUG(97)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/entity_framework_bulk_insert_extension.html">4. EntityFramework中支持BulkInsert扩展(79)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/06/03/practice_to_write_better_csharp_code.html">5. 编写更好的C#代码(78)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/windbg_cheat_sheet.html">6. WinDbg 命令三部曲：（一）WinDbg 命令手册(44)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/csharp_mjpeg_streaming.html">7. C#开源实现MJPEG流传输(32)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/lambda_design_patterns.html">8. Lambda应用设计模式(25)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/11/dotnet_csharp_ip_video_surveillance.html">9. 基于.NET打造IP智能网络视频监控系统(17)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/comparison_sorting_algorithms.html">10. 比较排序算法(16)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/05/09/i_am_a_bad_software_developer.html">11. 我是一个垃圾程序员(16)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/visual_studio_2013_new_feature_memory_dump_analysis.html">12. Visual Studio 2013 新功能 Memory Dump 分析器(14)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/way_to_lambda.html">13. Lambda表达式的前世今生(13)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/unit_test_with_microsoft_fakes.html">14. 使用 Microsoft Fakes 进行单元测试(10)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/complexity_of_algorithms.html">15. 算法复杂度分析(10)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/design_patterns.html">16. 设计模式之美(10)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/24/csharp_file_database.html">17. C#实现文件数据库(9)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/uml_association_aggregation_composition.html">18. UML中关联（Association）、聚合（Aggregation）和合成（Composition）之间的区别(9)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/opensource_ip_video_surveillance_system_part_2_foundation.html">19. 开源倾情奉献：基于.NET打造IP智能网络视频监控系统（二）基础类库介绍(8)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/binary_search_tree.html">20. 二叉查找树(8)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/24/csharp_binary_tree.html">21. 你曾实现过二叉树吗(7)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/troubleshooting_with_windbg.html">22. LoadTest内存和线程Troubleshooting实战(6)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/18/wpf_mvvm_async_waiting_view.html">23. WPF异步MVVM等待窗体(6)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/04/14/csharp_async_tcp_server.html">24. C#异步TCP服务器完整实现(6)</a></li><li><a href="http://www.cnblogs.com/gaochundong/archive/2013/06/01/aop_interception_with_unity.html">25. 使用Unity进行AOP对象拦截(6)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/agile_software_development_methodologies.html">26. 敏捷软件开发揭秘(6)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/least_knowledge_principle.html">27. 最少知识原则（Least Knowledge Principle）(6)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/liskov_substitution_principle.html">28. 里氏替换原则（Liskov Substitution Principle）(6)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/opensource_ip_video_surveillance_system_part_5_client_side.html">29. 开源倾情奉献：基于.NET打造IP智能网络视频监控系统（五）客户端介绍(6)</a></li><li><a href="http://www.cnblogs.com/gaochundong/p/windbg_sosex_cheat_sheet.html">30. WinDbg 命令三部曲：（三）WinDbg SOSEX 扩展命令手册(5)</a></li></ul></div>
</div></div></div><script type="text/javascript">loadBlogSideColumn();</script><iframe src="./秒懂C#通过Emit动态生成代码 - Dennis Gao - 博客园_files/container.htm" style="visibility: hidden; display: none;"></iframe>
			</div>
			
		</div><!--end: sideBarMain -->
	</div><!--end: sideBar 侧边栏容器 -->
	<div class="clear"></div>
	</div><!--end: main -->
	<div class="clear"></div>
	<div id="footer">
		
<!--done-->
Copyright ©2014 Dennis Gao
	</div><!--end: footer -->
</div><!--end: home 自定义的最大容器 -->


<iframe id="google_osd_static_frame_7357029463164" name="google_osd_static_frame" style="display: none; width: 0px; height: 0px;"></iframe></body></html>